package com.lanou.musicbox.adapter.onlinemusic;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.lanou.musicbox.fragment.onlinemusic.RankingListFragment;
import com.lanou.musicbox.fragment.onlinemusic.RecommendFragment;
import com.lanou.musicbox.fragment.onlinemusic.SingersFragment;
import com.lanou.musicbox.fragment.onlinemusic.PlaylistFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 杨海宁 on 15/10/20.
 * 网络音乐_TabLayoutAdapter
 */
public class NetworkMusicFragmentAdapter extends FragmentPagerAdapter{
    private String[] titles = {"推荐","排行榜","歌单","歌手"};
    private List<Fragment> fragments;

    public NetworkMusicFragmentAdapter(FragmentManager fm) {
        super(fm);


    }
    public void setData(List<Fragment> data){
        fragments = data;
        notifyDataSetChanged();
    }

    @Override
    public Fragment getItem(int position) {

        return fragments.get(position);

    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {

        return titles[position];
    }

}
